'use strict';
module.exports = {
  up: async (queryInterface, Sequelize) => {
    await queryInterface.createTable('Orders', {
      id: {
        allowNull: false,
        autoIncrement: true,
        primaryKey: true,
        type: Sequelize.INTEGER
      },
      outTradeNo: {
        type: Sequelize.STRING
      },
      userId: {
        type: Sequelize.INTEGER
      },
      status: {
          defaultValue: 1,
          type: Sequelize.INTEGER(1)
      },
      totalPrice: {
        type: Sequelize.DECIMAL(10, 2)
      },
      totalNum: {
        type: Sequelize.INTEGER
      },
      expressId: {
        type: Sequelize.INTEGER
      },
      expressNum: {
        type: Sequelize.STRING
      },
      paidAt: {
        type: Sequelize.DATE
      },
      pickedAt: {
        type: Sequelize.DATE
      },
      shippedAt: {
        type: Sequelize.DATE
      },
      finishedAt: {
        type: Sequelize.DATE
      },
      createdAt: {
        allowNull: true,
        type: Sequelize.DATE
      },
      updatedAt: {
        allowNull: true,
        type: Sequelize.DATE
      }
    });
  },
  down: async (queryInterface, Sequelize) => {
    await queryInterface.dropTable('Orders');
  }
};
